package com.jaj.services.rap;

import java.util.HashMap;
import java.util.Map;

import com.jaj.common.HttpUtils;

/**
 * Created by chm on 2018/1/24.
 *
 * @author j aj
 */
public class LoginService {

    /**
     * 模拟rap的登陆
     *
     * @param username 用户名
     * @param pwd      密码
     * @return
     */
    public static String rapLogin(String username, String pwd) {
        String url = RapConfig.Url.Login;
        Map<String, String> param = new HashMap<String, String>();
        param.put("account", username);
        param.put("password", pwd);
        try {
            String jsessionid = HttpUtils.httpClientPostReturnCookie(url, param);
            return jsessionid;
        }
        catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static void main(String[] args) {
        String result = rapLogin("", "");
        System.err.println(result);
    }

}
